/**
 * ...
 * @author Thot
 */

function ActionMenuMediator( p_view )
{
	this.init( ActionMenuMediator.NAME, p_view );
}

POO.extend( ActionMenuMediator, Mediator );


	// static
	ActionMenuMediator.NAME = "ActionMenuMediator";
	
	
	//private
	ActionMenuMediator.prototype._screen = null;
	
	// public
	ActionMenuMediator.prototype.init = function( p_name, p_data )
	{
		this._super.init.apply( this, [p_name, p_data] );
		this._screen = new ActionMenuScreen();
		this.listenNotifications();	
		this._screen.init( this.getViewComponent() );
		this._screen.signal.addListener( ActionMenuScreen.ON_CLICK, this._clickHandler, this );
		this._screen.signal.addListener( ActionMenuScreen.ON_OPEN, this._openProjectHandler, this );
	};
	
	ActionMenuMediator.prototype._openProjectHandler = function(p_url)
	{
		this.getFacade().sendNotification( ApplicationNotification.LOAD_PROJECT, p_url );
	};
	ActionMenuMediator.prototype._clickHandler = function(p_flag)
	{
		switch( p_flag )
		{
			case "close": this.getFacade().sendNotification( ApplicationNotification.UNLOAD_PROJECT ); break;
			case "new": this.getFacade().sendNotification( ApplicationNotification.UNLOAD_PROJECT ); break;
			case "save": this.getFacade().sendNotification( ApplicationNotification.SAVE_PROJECT, {"name":"google"} ); break;
		}
	};
	
	ActionMenuMediator.prototype.listenNotifications = function()
	{
		//this.addNotificationListener( ApplicationNotification.ADD_LAYER, this.onNotification );
	};

	ActionMenuMediator.prototype.onNotification = function( p_notificationType, p_data )
	{
		//var proxy = this.getFacade().getProxy( ApplicationProxy.NAME );
		//
		//switch ( p_notificationType )
		//{
			//case ApplicationNotification.ADD_LAYER:
				//break;
		//}
	};
